Word Import customization

Is it possible to import a word document in the attached format. The document is in word format, but each cell in the second column should be as an Object Text. The tricky part is that there are a list of tables that are embedded to the second column. Is it possible to embedded into an OLE while importing. Is there any inbuilt script, where i can tweak some part and make it work? :-)
Lion29 - Sat May 12 16:46:13 EDT 2012

Re: Word Import customization
Mathias Mamsch - Mon May 14 03:11:22 EDT 2012

I would suggest you use a simple 'preprocessing' word macro that will 'unpack' the outer table for you, that is bring the information into the classic 'book' form that you would get, when you export stuff from DOORS. You will then have much less problems to adapt the classic word import. You could also write a custom import script that will work with that one layout only - in any case that is quite some work to do and nothing that can be accomplished by tweaking some standard export. Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Word Import customization
Lion29 - Sat May 26 01:50:58 EDT 2012

Mathias Mamsch - Mon May 14 03:11:22 EDT 2012
I would suggest you use a simple 'preprocessing' word macro that will 'unpack' the outer table for you, that is bring the information into the classic 'book' form that you would get, when you export stuff from DOORS. You will then have much less problems to adapt the classic word import. You could also write a custom import script that will work with that one layout only - in any case that is quite some work to do and nothing that can be accomplished by tweaking some standard export. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Thanks a lot!!.
Any suggestion/recommendation about how an OLE works... To be honest, I'm not familiar with the OLE handling.
I had a look at the word importing scripts, but was bit nervous about the huge size... :-(

Re: Word Import customization
Mathias Mamsch - Wed May 30 03:10:43 EDT 2012

Lion29 - Sat May 26 01:50:58 EDT 2012
Thanks a lot!!.
Any suggestion/recommendation about how an OLE works... To be honest, I'm not familiar with the OLE handling.
I had a look at the word importing scripts, but was bit nervous about the huge size... :-(

Never mind the size of the word importer. The first thing you would need is an DXL Automation library. There are some out there, which already wrap the data model of word. The basic idea of importing text and / or OLE is that you use copy/paste to get the data to the DOORS client. You can get an example (Excel Import) here:

https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14492659&#14492659

It applies to Word too, you just copy paste stuff from Word instead from Excel. Then the problems an importer might need to solve (and you can borrow from the original code of the word import here):

  • Importing a hierarchy (the normal word importer for example will create a DOORS hierarchy from the Word Headings)
  • Importing DOORS tables (the normal word importer will make DOORS tables from Word tables)


If you do not need to deal with those issues (for example if you do not want DOORS tables), then your code can become much simpler then the original word importer. I guess the basic structure of the importer could be something like this (one would need to implement the functions):

 

 

OleAutoObj doc = open_the_word_document () 
OleAutoObj currentRange, dataSelection
 
currentRange = go_to_first_paragraph(doc) 
currentRange = skip_title_pages(doc) 
 
while (true) {
   Object objToImportTo   = null
   string sAttrToImportTo = ""
 
   // return the paragraphs in the word document that will be imported next
   dataSelection = get_next_hunk_of_data(currentRange)
 
   if (null dataSelection) { break }
 
   // will set the object and attribute depending on the current position and selection in the document
   // might create new objects if applicable
   where_do_I_need_to_import_to (currentRange, dataSelection, objToImportTo, sAttrToImportTo)
 
   import_data (dataSelection, objToImportTo, sAttrToImportTo)
}
 
infoBox "Hurray!" 
saveAndClose doc
// ... free ressources ...



Maybe that helps, regards, Mathias



 

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS